package com.saifan.wyy_ov.ui.home;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.RelativeLayout;

import com.saifan.wyy_ov.R;
import com.saifan.wyy_ov.config.Api;
import com.saifan.wyy_ov.ui.view.BaseActivity;
import com.saifan.wyy_ov.utils.StringUtil;

/**
 * @version V1.0.0
 * @author: lomasky
 * @date: 2015-5-11 16:44:15
 * @descrption 通知详情
 */

public class NotificationActivity extends BaseActivity {
    private Toolbar toolbar;
    private WebView webView;
    private String GG_ZJ;
    private String GG_WZDZ;
    private RelativeLayout loadlay;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        GG_ZJ = getIntent().getStringExtra("GG_ZJ");
        GG_WZDZ = getIntent().getStringExtra("GG_WZDZ");

        setContentView();
        test();
    }

    public void setContentView() {
        setContentView(R.layout.activity_notification);

        loadlay = (RelativeLayout) findViewById(R.id.loading_lay);
        loadlay.setVisibility(View.VISIBLE);

        this.webView = (WebView) findViewById(R.id.webView);
        this.webView.setWebChromeClient(new WebChromeClient() {


            @Override
            public void onProgressChanged(WebView view, int newProgress) {
                super.onProgressChanged(view, newProgress);
                if (newProgress == 100) {
                    loadlay.setVisibility(View.GONE);
                }


            }
        });
        this.webView.setWebViewClient(new WebViewClient()
         );
        this.toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        if (!StringUtil.isNullOrEmpty(GG_WZDZ)) {
            if (GG_WZDZ.startsWith("http://") || GG_WZDZ.startsWith("https://")) {
                webView.loadUrl(GG_WZDZ);
            } else {
                webView.loadUrl("http://" + GG_WZDZ);
            }


        } else {
            webView.loadUrl(Api.getUrlIp()  + Api.Customer.INFORMATIONRELEASE + GG_ZJ);

        }

    }

    public void test() {
    }


}
